home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / usr_-_Usr_Files / INCLUDE / SIGNAL.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  5KB  |  165 lines

  1. /* Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3.  
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Library General Public License as
  6. published by the Free Software Foundation; either version 2 of the
  7. License, or (at your option) any later version.
  8.  
  9. The GNU C Library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12. Library General Public License for more details.
  13.  
  14. You should have received a copy of the GNU Library General Public
  15. License along with the GNU C Library; see the file COPYING.LIB.  If
  16. not, write to the, 1992 Free Software Foundation, Inc., 675 Mass Ave,
  17. Cambridge, MA 02139, USA.  */
  18.  
  19. /*
  20.  *    ANSI Standard: 4.7 SIGNAL HANDLING <signal.h>
  21.  */
  22.  
  23. #ifndef _SIGNAL_H
  24. #define _SIGNAL_H
  25.  
  26. #include <features.h>
  27. #include <sys/types.h>
  28. #include <linux/signal.h>
  29.  
  30. #ifndef SIGCLD
  31. #define SIGCLD        SIGCHLD
  32. #endif
  33.  
  34. /* SVR4 */
  35. #ifndef SA_RESETHAND
  36. #define SA_RESETHAND SA_ONESHOT
  37. #endif
  38.  
  39. /* SVR4 */
  40. #ifndef SA_NODEFER
  41. #define SA_NODEFER SA_NOMASK
  42. #endif
  43.  
  44. typedef int sig_atomic_t;
  45.  
  46. typedef __sighandler_t    SignalHandler;
  47.  
  48. #ifndef BADSIG
  49. #define BADSIG        SIG_ERR
  50. #endif
  51.  
  52. /* The Interviews version also has these ... */
  53.  
  54. #define SignalBad    ((SignalHandler)-1)
  55. #define SignalDefault    ((SignalHandler)0)
  56. #define SignalIgnore    ((SignalHandler)1)
  57.  
  58. __BEGIN_DECLS
  59.  
  60. extern __const char * __const sys_siglist[];
  61. extern __const char * __const _sys_siglist[];
  62.  
  63. extern __sighandler_t
  64.         signal __P ((int __sig, __sighandler_t));
  65. extern int    raise __P ((int __sig));
  66. extern int    __kill __P ((pid_t __pid, int __sig));
  67. extern int    kill __P ((pid_t __pid, int __sig));
  68. extern int    killpg __P ((int __pgrp, int __sig));
  69. extern int    sigaddset __P ((sigset_t *__mask, int __sig));
  70. extern int    sigdelset __P ((sigset_t *__mask, int __sig));
  71. extern int    sigemptyset __P ((sigset_t *__mask));
  72. extern int    sigfillset __P ((sigset_t *__mask));
  73. extern int    sigismember __P ((__const sigset_t *__mask, int __sig));
  74. extern int    sigpending __P ((sigset_t *__set));
  75.  
  76. extern int    __sigprocmask __P ((int __how, __const sigset_t *__set,
  77.             sigset_t *__oldset));
  78. extern int    sigprocmask __P ((int __how, __const sigset_t *__set,
  79.             sigset_t *__oldset));
  80.  
  81. extern int    sigsuspend __P ((__const sigset_t *sigmask));
  82.  
  83. extern int    __sigaction __P ((int __sig, struct sigaction *__act,
  84.             struct sigaction *__oldact));
  85. extern int    sigaction __P ((int __sig, struct sigaction *__act,
  86.             struct sigaction *__oldact));
  87.  
  88. #define __sigemptyset(set)    ((*(set) = 0L), 0)
  89. #define __sigfillset(set)       ((*(set) = -1L), 0)
  90. #define __sigaddset(set, sig)   ((*(set) |= __sigmask (sig)), 0)
  91. #define __sigdelset(set, sig)   ((*(set) &= ~__sigmask (sig)), 0)
  92. #define __sigismember(set, sig) ((*(set) & __sigmask (sig)) ? 1 : 0)
  93.  
  94.  
  95. #ifdef __OPTIMIZE__
  96. #define sigemptyset    __sigemptyset
  97. #define sigfillset    __sigfillset
  98.  
  99. /* We don't do that any more since it causes problems due to
  100.  * "sig" > _NSIG and "sig" < 1. It isn't worth the touble to make
  101.  * them inline and static. Use __sigxxxxx if you want speed with
  102.  * correct "sig".
  103.  */
  104. #if 0
  105. #define sigaddset    __sigaddset
  106. #define sigdelset    __sigdelset
  107. #define sigismember    __sigismember
  108. #endif
  109.  
  110. #endif
  111.  
  112.  
  113. /* Return a mask that includes SIG only.  */
  114. #define __sigmask(sig)    (1 << ((sig) - 1))
  115.  
  116. extern int __sigsetmask __P ((int __mask));
  117. extern int __siggetmask __P ((void));
  118. extern int __sigblock __P ((int __mask));
  119. extern int __sigpause __P ((int __mask));
  120.  
  121. #ifdef  __USE_SVID
  122. /* SVID names for the same things.  */
  123. extern __sighandler_t ssignal __P ((int __sig, __sighandler_t __handler));
  124. extern int gsignal __P ((int __sig));
  125.  
  126. #endif /* Use SVID.  */
  127.  
  128. /* BSD */
  129. #ifdef __USE_BSD
  130. #define sigmask        __sigmask
  131.  
  132. extern int    sigblock __P ((int __mask));
  133. extern int    sigpause __P ((int __mask));
  134. extern int    sigsetmask __P ((int __mask));
  135. extern int    siggetmask __P ((void));
  136. extern void    psignal __P ((int __sig, __const char *__str));
  137.  
  138. extern int    siginterrupt __P ((int __sig, int __flag));
  139.  
  140. /* The `sig' bit is set if the interrupt on it
  141.  * is enabled via siginterrupt (). */
  142. extern sigset_t _sigintr;
  143.  
  144. #endif  /* Use BSD.  */
  145.  
  146. #if defined(__USE_BSD_SIGNAL) || defined(__FAVOR_BSD)
  147.  
  148. extern __sighandler_t
  149.         __bsd_signal __P ((int __sig, __sighandler_t));
  150. #define signal    __bsd_signal
  151.  
  152. #endif    /* __USE_BSD_SIGNAL || __FAVOR_BSD */
  153.  
  154. __END_DECLS
  155.  
  156. #if _MIT_POSIX_THREADS
  157. #define __SIGFILLSET        0xffffffff
  158. #define __SIGEMPTYSET        0
  159. #define __SIGADDSET(s,n)    ((*s) |= (1 << ((n) - 1)))
  160. #define __SIGDELSET(s,n)    ((*s) &= ~(1 << ((n) - 1)))
  161. #define __SIGISMEMBER(s,n)    ((*s) & (1 << ((n) - 1)))
  162. #endif
  163.  
  164. #endif /* _SIGNAL_H */
  165.